// JavaScript Document

//｛“category”:5}	

function get_posts_callback(data)
{
//	alert(data);

	try{
	data=str2json(data);
	}catch(e){}
	try{	
			var fn=threadLocalParamMap.fn;
			var xhr=threadLocalParamMap.xhr
		 //	alert("fn:"+fn);
		 //when list mode 
		 //fn:function (data){ render.movie_list_normal(data); load_finish_p89(); }
			  fn && fn(data);
			  // xhr.abort	(req_id);
	  
	  }catch(e)
	{
		showErr(e);	
	}
}
function get_posts(paramJsonMap)
{
try{	
	var  sql_t = 'material_type';
	var xhr=paramJsonMap.xhr;
	var fn=paramJsonMap.fn;
	var err=paramJsonMap.err;
	var value=paramJsonMap.value;
	threadLocalParamMap.xhr=xhr;
	threadLocalParamMap.fn=fn;

//com.attilax.api.imoveSqlExcutor.exe
	if(	window.location.host=="")  //cs envi
	{
	   //todox pa6 param use naming params jsonfmt ..not use obj arr
	   //beir param1=xxx param2=xxx param3=xxx 
		var mp="$method=aaaCms.CmsImpLocalFileVer.list_nocache&$callback=get_posts_callback&param="+value;
	//	alert(mp);
	//	HRE.exe(mp,get_posts_callback);	
get_posts_callback(	test_list_data);
		
		//	var json=urlParams2json(param);
		//	sendNSCommand(json.method,param,callback);
		//		alert("sendNSCommand ok");
		return;
		
	}

		get_posts_callback(	test_list_data);
            
}catch(e)
{
	showErr(e);	
}
}


function get_post( id)
{
	
	try{
		var mid= id;
		var xhr=threadLocalParamMap.xhr;
		var fn=threadLocalParamMap.fn;
		var err=threadLocalParamMap.fn;
		var value=threadLocalParamMap.value;
		var sql='select   *  from gv_material where material_id='+mid+' ';		
		if(	window.location.host=="")  //cs envi
			{
				mid=encodeURIComponent(mid);
				var mp="$method=aaaCms.CmsImpLocalFileVer.get_post_api&$callback=get_posts_callback&param="+mid;
			//	alert("get post mp:"+mp);
			get_posts_callback(	test_list_data);
				return;
			}else
				get_posts_callback(	test_list_data);
	
	
	}catch(e)
	{
		showErr(e);	
	}
}


function query_posts( keyword)
{
	var xhr=threadLocalParamMap.xhr;
var fn=threadLocalParamMap.fn;
var err=threadLocalParamMap.fn;
var value=threadLocalParamMap.value;

	if(	window.location.host=="")  //cs envi
			{
				mid=encodeURIComponent(mid);
				var mp="$method=aaaCms.CmsImpLocalFileVer.search&$callback=get_posts_callback&param="+keyword;
			//	alert("get post mp:"+mp);
				HRE.exe(mp,get_posts_callback);	
				return;
			}
			else
	 xhr.req({http_param: "select   * from gv_material where material_keyword like '"+keyword+"%'  limit 30 "}, fn, err);
}